apiVersion: apps/v1
kind: Deployment
metadata:
  name: coordinator
  namespace: {{ .Values.namespace }}
spec:
  replicas: {{ .Values.coordinator.replicaCount }}
  selector:
    matchLabels:
      app: coordinator
  template:
    metadata:
      labels:
        app: coordinator
    spec:
      serviceAccountName: coordinator-serviceaccount
      containers:
        - command:
            - "coordinator"
            - "coordinator"
            - "--pulsar-admin-url=http://pulsar.chroma:8080"
            - "--pulsar-url=pulsar://pulsar.chroma:6650"
            - "--notifier-provider=pulsar"
          image: coordinator
          imagePullPolicy: IfNotPresent
          name: coordinator
          ports:
            - containerPort: 50051
              name: grpc

---

apiVersion: v1
kind: Service
metadata:
  name: coordinator
  namespace: {{ .Values.namespace }}
spec:
  ports:
    - name: grpc
      port: 50051
      targetPort: grpc
  selector:
    app: coordinator
  type: ClusterIP

---

apiVersion: v1
kind: ServiceAccount
metadata:
  name: coordinator-serviceaccount
  namespace: {{ .Values.namespace }}

---

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: coordinator-serviceaccount-rolebinding
  namespace: {{ .Values.namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: pod-watcher
subjects:
- kind: ServiceAccount
  name: coordinator-serviceaccount
  namespace: {{ .Values.namespace }}

---
